import { LOGIN_URL } from "@/config/config";
import { RouterPath } from "@/enums/routerPath";
import { RouteRecordRaw } from "vue-router";
import { demoRouter } from "./common/demo";
import { errorRouter } from "./common/error";

/**
 * staticRouter(静态路由)
 */
export const staticRouter: RouteRecordRaw[] = [
	{
		path: "/",
		redirect: RouterPath.deviceList
	},
	{
		path: LOGIN_URL,
		name: "login",
		component: () => import("@/views/login/index")
	},
	{
		path: "/layout",
		name: "layout",
		component: () => import("@/layouts/index.vue"),
		// component: () => import("@/layouts/indexAsync.vue"),
		redirect: RouterPath.deviceList,
		children: [
			{
				path: "/home/index",
				name: "home",
				component: () => import("@/views/dashboard/default/index"),
				meta: {
					icon: "iconfont iconbx-home",
					isHide: true,
					title: "首页"
				}
			},
			{
				path: "/user/profile",
				name: "userProfile",
				component: () => import("@/views/basic/user/profile/user-profile"),
				meta: {
					icon: "iconuser1",
					isHide: true,
					title: "个人中心"
				}
			},
			//系统监控
			{
				path: "/system/status",
				name: "systemStatus",
				component: () => import("@/views/system/status/index"),
				meta: {}
			},
			...errorRouter,
			...demoRouter
		]
	},
	{
		path: "/layoutPublic",
		name: "layoutPublic",
		component: () => import("@/layouts/LayoutPublic/index.vue"),
		children: []
	}
];

/**
 * notFoundRouter(找不到路由)
 */
export const notFoundRouter = {
	path: "/:pathMatch(.*)*",
	name: "notFound",
	redirect: { name: "404" }
};
